package com.fowo.api.service.handleWork;

import com.fowo.api.model.loan.advance.payment.LoanAdvancePaymentFinishRequestPayoutAction;
import com.fowo.api.model.loan.advance.payment.LoanAdvancePaymentVo;
import com.fowo.api.service.LoanAdvancePaymentService;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import javax.annotation.Resource;

@Component
public class LoanAdvancePaymentFinishRequestPayout implements LoanAdvancePaymentFinishRequestPayoutAction {

    @Resource
    private LoanAdvancePaymentService loanAdvancePaymentService;

    @Override
    public void run(Long id) throws Exception {
        LoanAdvancePaymentVo loanAdvancePaymentVo = loanAdvancePaymentService.getVoById(id);
        Assert.notNull(loanAdvancePaymentVo,"改单据不存在");
        loanAdvancePaymentVo.setStatus("40");
        loanAdvancePaymentService.update(loanAdvancePaymentVo);
        //TODO 会写采购单未付金额
        loanAdvancePaymentVo.getPurchaseOrderCode();
    }
}
